/**
 * 产品查看js
 */
var productInfoLook={
	dataCache:null,
	key:null,
	
	startEvent:function(){
		$("#recordTab ul").idTabs();
		productInfoLook.showInfoById();
	},
	
	showInfoById:function(){
		var id = art.dialog.data('lokId');
		productInfoLook.key = id+"_productType04_Key";
		
		var ret = eval('(' + localStorage.getItem(productInfoLook.key) + ')');
		
		for(var i in ret){
			var text=ret[i];
			if(i=='establishDate'||i=='onlineDate'||i=='endDate'||i=='releasesDate'||i=='balanceDate'||i=='discountEndDate'||i=='raiseBeginDate'||i=='raiseEndDate'){
				text=text==null?'':(new Date(text)).format('yyyy-MM-dd');
			}else if(i=='prodType'||i=='publishType'||i=='riskLevel'||i=='currency'||i=='proStatus'){
				text=jsUtils.getDictionaryTxtByType(i, text);
			}else if(i=='isOversea'||i=='discount'||i=='discountRate'||i=='hotSale' ||i=='directional'){
				text=(text==null?'':(text==0?'否':'是'));
			}else if(i=='proTerm'){
				if(text > 360){
					text = text/360 + "年";
				}else if(text > 30){
					text = text/30 + "月";
				}else{
					text = text + "天";
				}
				
				 
			}else if(i=='clearDate'){
                text=text==null?'':(new Date(text)).format('yyyy-MM-dd hh:mm:ss');
			}
			$('#com-addForm td[name="'+i+'"]').html(text);
		}
				
		$('#introduceTxt').html((ret.introduceTxt==null?'':ret.introduceTxt));
		$('#incomeTxt').html((ret.incomeTxt==null?'':ret.incomeTxt));
		$('#riskctrlTxt').html((ret.riskctrlTxt==null?'':ret.riskctrlTxt));
		$('#signflowTxt').html((ret.signflowTxt==null?'':ret.signflowTxt));
	},
	
	init:function(){
		productInfoLook.startEvent();
	}
}
$(document).ready(function() {
	productInfoLook.init();
});